#include <cstdio>

int main( )
{
    int n, m, i, j, k, c1[ 101 ], c2[ 101 ], w[ 101 ], t;
    while ( scanf("%d%d", &n, &m) != EOF )
    {
        for ( i = 0; i < n; i++ )
        {
            scanf("%d%d", &t, &w[ i ]);
            w[ i ] -= t;
            m -= t;
        }
        if ( m < 0 )
            printf("0\n");
        else
        {
            for ( i = 0; i <= m; i++ )
                c1[ i ] = c2[ i ] = 0;
            c1[ 0 ] = 1;
            for ( i = 0; i < n; i++ )
            {
                for ( j = 0; j <= m; j++ )
                    for ( k = 0; k + j <= m && k <= w[ i ]; k++ )
                        c2[ k + j ] += c1[ j ];
                for ( j = 0; j <= m; j++ )
                {
                    c1[ j ] = c2[ j ];
                    c2[ j ] = 0;
                }
            }
            printf("%d\n", c1[ m ]);
        }
    }
    return 0;
}
